package com.itfreer.data.general;

import com.itfreer.utils.StringUtils;

import java.util.HashMap;

/**
 * 类功能说明 定义表关系节点
 */
public class RelationNode {
	private HashMap<String, RelationInfo> parentRelationNode;
	public HashMap<String, RelationInfo> childRelationNode;

	/**
	 * 初始化类实例
	 * 
	 * @param tablePK
	 */
	public RelationNode(String tablePK) {
		if (!StringUtils.HasLength(tablePK))
			throw new RuntimeException("tableName不能为null！");

		tablePK.trim().toUpperCase();
		parentRelationNode = new HashMap<String, RelationInfo>();
		childRelationNode = new HashMap<String, RelationInfo>();
	}

	/**
	 * 获取当前表的父表 key:父表名，value
	 * 
	 * @return
	 */
	public HashMap<String, RelationInfo> getParentRelationNode() {
		return parentRelationNode;
	}

	/**
	 * 获取当前表的子表 key:子表名，value:关系
	 * 
	 * @return
	 */
	public HashMap<String, RelationInfo> getChildRelationNode() {
		return childRelationNode;
	}
}
